<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
  <title>Test Case for dynamic script evaluation.</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>

<h1>Dynamic Script Evaluation</h1>
<br/>
<i>Jan Odvarko, odvarko@gmail.com</i>

<ol>
<li>Open Firebug, enable the Script & Console panels.</li>
<li>Reload this page.</li>
<li>Click on the <code style="color:green">Execute Test</code> button below.</li>
<li>Check the Console panel, you shoiuld see two logs: <code>quack</code> and <code>meow!!</code>.</li>
</ol>

<button id="testButton" onclick="onExecuteTest()">Execute Test</button>

<script type="text/javascript">
function onExecuteTest()
{
    // Load the code dynamically
    var req = new XMLHttpRequest();
    req.open('GET','payloadCatsAndDucks.js', false);
    req.send(null);
    eval(req.responseText);

    // Now use the code
    prod(new duck());
    prod(new cat());
}
</script>

</body>
</html>
